package com.luo.demo;

/**
 * @author: luosiyu
 * @Description:
 * @Version: 1.0
 */

public class Circle extends shape{
    public Circle() {
    }

    public Circle(double a) {
        super(a);
    }

    @Override
    public double area() {
//        return 3.14*getA()*getA();
        double a = Math.PI*getA()*getA();

        return Double.valueOf(String.format("%.2f",a));
    }

    @Override
    public double length() {
        double a =2*Math.PI*getA();
        return Double.valueOf(String.format("%.2f",a));
    }

    @Override
    public String toString() {
        return "圆形的面积="+area()+";周长="+length();
    }
}
